"""
    create by IAmFiveHigh on 2023/8/17
"""
from LA.Vector import Vector

if __name__ == '__main__':
    v1 = Vector([5, 2])
    print(f"v1 = {v1} dimension = {len(v1)}")
    print(f"v1 = {v1} v1.1 = {v1[1]}")

    v2 = Vector([3, 1])
    print(f"{v1} + {v2} = {v1 + v2}")
    print(f"{v1} - {v2} = {v1 - v2}")

    k = 3
    print(f"{v1} * {k} = {v1 * k}")
    print(f"{k} * {v1} = {k * v1}")

    print(f"-{v1} = {-v1}")

    v3 = Vector([3, 4])
    print(f"{v3} 的长度是 {v3.norm()}")
    print(f"{v3}的单位向量是 {v3.normalize()}")
    print(f"{v3}的单位向量长度是 {v3.normalize().norm()}")

    print(f"{v1}·{v3} = {v1.dot(v3)}")

    v4 = Vector.zero(3)
    try:
        print(f"{v3} / 0 = {v3 / 0}")
    except Exception as e:
        print(e)

    try:
        print(f"{v1} · {v4} = {v1.dot(v4)}")
    except Exception as e:
        print(e)

    v4 = Vector([1, 2, 3])
    v5 = Vector([2, 3, 4])
    v6 = Vector([1, 2, 3])
    print(f"{v2} == {v4} is {v2 == v4}")
    print(f"{v4} == {v5} is {v4 == v5}")
    print(f"{v4} == {v6} is {v4 == v6}")
    print(f"{v4} != {v6} is {v4 != v6}")
